package com.ds.yuntukubackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

@Getter
public enum SpaceLevelEnum {

    //空间级别：0-普通版 1-专业版 2-旗舰版
    COMMON("普通版",0,100,100L * 1024*1024),
    PROFESSIONAL("专业版",1,1000,1000L * 1024 * 1024),
    FLAGSHIP("旗舰版",2,10000,10000L * 1024 * 1024);

    private final String text;
    private final int value;
    private final long maxCount;
    private final long maxSize;


    SpaceLevelEnum(String text,int value,long maxCount,long maxSize){
        this.text = text;
        this.value = value;
        this.maxCount = maxCount;
        this.maxSize = maxSize;
    }

    /**
     * 根据value 获得枚举值
     * @param value
     * @return
     */
    public static SpaceLevelEnum getEnumByValue(int value){
        if(ObjUtil.isNull(value)){
            return null;
        }
        for(SpaceLevelEnum spaceLevelEnum : SpaceLevelEnum.values()){
            if(spaceLevelEnum.value == value){
                return spaceLevelEnum;
            }
        }
        return null;
    }
}
